var draging = false;//是否拖拽中
  		var dragElement = null;//当前拖拽的th
  		var offsetLeft = 0;//当前拖拽的th与绝对左坐标
  		var offsetWidth = 0;//当前拖拽的th的绝对宽度
  		function mousedown(){
  			if(draging) return;
  			draging = true;
  			dragElement = window.event.srcElement.parentNode;
  			offsetLeft = dragElement.offsetLeft;
  			document.body.style.cursor = "col-resize";
  			document.body.onselectstart = function(){return false;};//拖拽的时候，鼠标滑过字的时候，不让选中(默认鼠标选中字的效果,大家都知道)
  		}
  		function mouseup(){
  			draging = false;
  			dragElement = null;
  			document.body.style.cursor = "auto";
  			document.body.onselectstart = function(){return true};
  		}
  		function mousemove(){
  			if(draging && dragElement){
	  			var width = event.clientX-offsetLeft;
	  			if(width>0){
		  			dragElement.style.width = width;
		  			offsetWidth = dragElement.offsetWidth;
	  			}else{
	  				dragElement.style.width = offsetWidth;
	  			}
  			}
  		}
  		
  		//创建<span class="dragable" onmousedown="mousedown();">&nbsp;</span>
  		function createSpan(){
  			var span = document.createElement("span");
  			span.className = "dragable";
  			span.attachEvent("onmousedown",mousedown);
  			span.innerHTML = "";
  			return span;
  		}
  		function init(){
  			//在th添加span
  			var ths = document.getElementsByTagName("th");
  			for(var i=0;i<ths.length;i++){
  				ths[i].appendChild(createSpan());
  			}
  		}